﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
namespace DAL
{
    public class LoginDAL
    {
        DBHelper db = new DBHelper();
        

        
        public bool Studentlogin(int StudentID,string StudentPwd)
        {
            string sql = $"select * from[dbo].[StudentInfoS] where StudentID='{StudentID}' and StudentPwd='{StudentPwd}'";
            if (db.GetData(sql).Tables[0].Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool Teacherlogin(LoginModel lg)
        {
            string sql = $"select * from[dbo].[TeacherSInfoS] where TeacherID='{lg.TeacherID}' and TeacherPwd='{lg.TeacherPwd}'";
            if (db.GetData(sql).Tables[0].Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public bool Adminlogin(LoginModel lg)
        {
            string sql = $"select * from[dbo].[Admin] where AdminID='{lg.AdminID}' and AdminPwd='{lg.AdminPwd}'";
            if (db.GetData(sql).Tables[0].Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

    }
}
